﻿// Copyright 2005, 2006 - Morten Nielsen (www.iter.dk)
//
// This file is part of SharpMap.
// SharpMap is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// SharpMap is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.

// You should have received a copy of the GNU Lesser General Public License
// along with SharpMap; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 

using System;
using System.Runtime.Serialization;
using System.Collections.Generic;

namespace Petra.Gis.ReferenceSystemServices
{
  /// <summary>
  /// A meridian used to take longitude measurements from.
  /// </summary>
  [DataContract(Name="PRIMEM")]
  public partial class PrimeMeridian
  {

    //protected Metadata _metadata;

    /// <summary>
    /// xaml constr
    /// </summary>
    public PrimeMeridian() { }


    /// <summary>
    /// Initializes a new instance of a prime meridian
    /// </summary>
    /// <param name="longitude">Longitude of prime meridian</param>
    /// <param name="angularUnit">Angular unit</param>
    /// <param name="metadata">object metadata</param>
    public PrimeMeridian(double longitude, AngularUnit angularUnit, Metadata metadata)
    {
      Metadata = metadata;
      Longitude = longitude;
      AngularUnit = angularUnit;
    }


    #region PrimeMeridian Members

    //protected double _Longitude;

    /// <summary>
    /// Gets or sets the longitude of the prime meridian (relative to the Greenwich prime meridian).
    /// </summary>
    [DataMember(Name="LON", Order = 1)]
    public double Longitude
    { get; set; }




    //protected AngularUnit _AngularUnit;

    /// <summary>
    /// Gets or sets the AngularUnits.
    /// </summary>
    [DataMember(Name="UNIT", Order = 2)]
    public AngularUnit AngularUnit
    { get; set; }




    /// <summary>
    /// Gets or sets the Metadata.
    /// </summary>
    [DataMember(Name="INFO", Order = 3)]
    public Metadata Metadata
    { get; set; }

 


    /// <summary>
    /// Checks whether the values of this instance is equal to the values of another instance.
    /// Only parameters used for coordinate system are used for comparison.
    /// Name, abbreviation, authority, alias and remarks are ignored in the comparison.
    /// </summary>
    /// <param name="obj"></param>
    /// <returns>True if equal</returns>
    public bool EqualParams(object obj)
    {
      if (!(obj is PrimeMeridian))
        return false;
      PrimeMeridian prime = obj as PrimeMeridian;
      return prime.AngularUnit.EqualParams(this.AngularUnit) && prime.Longitude == this.Longitude;
    }

    #endregion

  }
}
